<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" language="java" %>
<%@ page import="javax.jdo.*" %>
<%@ page import="com.appspot.bibtable.UrlCollection" %>
<%@ page import="com.appspot.bibtable.model.*" %>
<%@ page import="com.appspot.bibtable.view.html.*" %>
<%@ page import="com.google.appengine.api.users.*" %>
<%
HtmlTemplate template = new HtmlTemplate();
template.setTitle("User Registration");
template.setRequest(request);
template.startDocument(out);
template.startContent(out);
	
UserService service = UserServiceFactory.getUserService();
if (!service.isUserLoggedIn())
{
%>
<p class="notice">
	You need to <a href="<%= service.createLoginURL(request.getRequestURI()) %>">sign in</a> with your google account for registration.
</p>
<%
}
else
{
	User user = service.getCurrentUser();
	UserInfo info = UserInfo.getUserInfoOf(user);
	if (info != null)
	{
%>
<p class="notice">
	You have already registered.
	<a href="<%= UrlCollection.INDEX %>">Go to start page</a>.
</p>
<%
	}
	else
	{
%>
<h3>IMPORTANT NOTICE</h3>
<p>
	You should read and understand <a href="<%= UrlCollection.TERMS_OF_USE %>">Terms of Use of BibTable</a>
	before your registration.
</p>
<form action="/register" method="post">
<div>
	<input type="submit" value="Register Now" />
</div>
</form>
<%
	}
}
template.endContent(out);
template.endDocument(out);
%>
